/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.amse.grigory.dchess.view;

import java.util.Scanner;
import javax.swing.*;
import org.amse.grigory.dchess.dchess.DChess;

/**
 *
 * @author grigory
 */
public class HelpDialog extends JDialog {
    private static ClassLoader myClassLoader = DChess.class.getClassLoader();

    public HelpDialog(JFrame frame) {
        super(frame, true);
        setLocation(frame.getLocation().x + 50, frame.getLocation().y + 50);
        fillDialog();
        setSize(800, 600);
        setResizable(false);
        setVisible(true);
    }

    private void fillDialog() {
        JTextArea text = new JTextArea();        
        Scanner scanner = new Scanner(myClassLoader.getResourceAsStream("org/amse/grigory/dchess/dchess/man"));
        while (scanner.hasNextLine()){
            text.append(scanner.nextLine()+"\n");
        }
        text.setEditable(false);
        JScrollPane scroll = new JScrollPane(text,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);        
        getContentPane().add(scroll);
        

    }
}
